package com.sh.apiinterface.controller;

import com.sh.apiinterface.entity.User;
import org.springframework.web.bind.annotation.*;

import java.util.Random;

@RestController
@RequestMapping("/interface/random")
public class RandomController {


    private static final String[] str = {
            "随机文本1",
            "随机文本2",
            "随机文本3",
            "随机文本4",
            "随机文本5",
            "随机文本6",
            "随机文本7",
            "随机文本8",
            "随机文本9",
            "随机文本10",
    };

    @PostMapping("/num")
    public String getNum() {
        Random random = new Random();
        return String.valueOf(random.nextInt(1000000));
    }


    @GetMapping("/txt")
    public String getTxt() {
        Random random = new Random();
        return str[random.nextInt(10)];
    }

    @GetMapping("/test")
    public String getTest() {
      return "test";
    }

}
